﻿using Mt.Site.Core.Base.Utils.Excel;
using Mt.Site.Core.Base.Utils.Excel.Import;
using NPOI.SS.UserModel;
using System;
using System.Collections.Generic;

namespace Mt.Site.Web.Areas.B.Models.SEO
{
    public class SeoListExcelDataReader : ExcelImport<ImportSeoDto>.ExcelImportHelper
    {
        public List<ImportSeoDto> Data = new List<ImportSeoDto>();

        public List<string> Rejects = new List<string>();


        public SeoListExcelDataReader()
        {
        }

        public void Add(ImportSeoDto model)
        {
            Data.Add(model);
        }

        public ImportSeoDto IsExist(IRow row)
        {
            return null;
        }

        public bool Map(IRow row, ImportSeoDto dto)
        {
            try
            {
                dto.Url = row.GetValue<string>(0);
                dto.Title = row.GetValue<string>(1);
                dto.Description = row.GetValue<string>(2);
                dto.Keywords = row.GetValue<string>(3);
            }
            catch(Exception ex)
            {
                dto.Exception = ex.Message; 
            }

            return true;
        }

        public void Update(ImportSeoDto model)
        {
            throw new NotImplementedException();
        }
    }
}
